package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(30);not null"`
	Password string `gorm:"type:char(32);not null"`
}

func (u *User) FindUser(db *gorm.DB, account string) (*User, error) {
	err2 := db.Debug().Where("account=?", account).Find(u).Error
	return u, err2
}

func (u *User) FindUserId(db *gorm.DB, id int64) (*User, error) {
	err2 := db.Debug().Where("id=?", id).Find(u).Error
	return u, err2
}
